WatchView.tsx 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. 'use client';
  2. import { ChannelDetail } from '@/types/channel';
  3. import ChatSidebar from './ChatSidebar';
  4. import Link from 'next/link';
  5. import './style.scss';
  6. type Props = {
  7. channel: ChannelDetail;
  8. };
  9. export default function WatchView({ channel }: Props) {
  10. const embedUrl = channel.videoId
  11. ? `https://www.youtube.com/embed/${channel.videoId}?autoplay=1&mute=1`
  12. : null;
  13. return (
  14. <div className="watch-page">
  15. <div className="watch-page__content">
  16. {/* 플레이어 */}
  17. <div className="watch-page__player">
  18. {embedUrl ? (
  19. <iframe
  20. src={embedUrl}
  21. allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"
  22. allowFullScreen
  23. title={channel.liveTitle || channel.name}
  24. />
  25. ) : (
  26. <div className="watch-page__offline">
  27. <p>현재 방송 중이 아닙니다</p>
  28. <Link href={`/channel/${channel.channelSID}`}>채널 페이지로 이동</Link>
  29. </div>
  30. )}
  31. </div>
  32. {/* 채널 정보 */}
  33. <div className="watch-page__info">
  34. <h1 className="watch-page__title">{channel.liveTitle || channel.name}</h1>
  35. <div className="watch-page__channel">
  36. <Link href={`/channel/${channel.channelSID}`} className="watch-page__channel-name">
  37. {channel.name}
  38. {channel.isVerified && <span className="watch-page__verified" title="인증됨">✓</span>}
  39. </Link>
  40. {channel.handle && <span className="watch-page__handle">@{channel.handle}</span>}
  41. </div>
  42. <div className="watch-page__actions">
  43. <Link href={`/donation/${channel.channelSID}`} className="watch-page__donate-btn">
  44. 💰 후원하기
  45. </Link>
  46. </div>
  47. </div>
  48. </div>
  49. {/* 우측 채팅 */}
  50. <div className="watch-page__chat">
  51. <ChatSidebar />
  52. </div>
  53. </div>
  54. );
  55. }